<?php 
$count = 0;
if(isset($error))
	echo '<script type="text/javascript">alert("'.$error.'");</script>';

foreach($ujian as $row){
	if($row->start){
?>
<div class="portlet-body">
	<div class="row-fluid">
		<div class="ujian-btn span12">
			<div>
				<h5><?php echo $row->uj_name;?></h5>
			</div>
			<div>
				<h6><?php echo $row->mp_name;?></h6>
				<?php if($row->start == 1){ ?><a href="ujian/masuk_ujian/<?php echo $row->uj_id;?>"><i class="btn green">Masuk</i></a>
				<?php }else{ ?><i class="btn grey">Belum Mulai</i> <?php }?>
			</div>
			<div>
				<h6><?php echo date('d-m-Y', strtotime($row->uj_date));?> (<?php echo $row->uj_start.' - '.$row->uj_end;?>)</h6>
			</div>
	
		</div>
	</div>
</div>
<?php
	$count++;
	}
}
if($count==0){
?> 
	<div class="portlet-body">
		<div class="row-fluid" align="center">
			<h3>Tidak ada ujian dalam waktu dekat</h3><br />
			<h5>(untuk hasil ujian yang telah diikuti dapat dilihat di halaman laporan)</h5>
		</div>
	</div>
<?php }?>
<script type="text/javascript">
	function countdown(element) {
	    interval = setInterval(function() {
	        var el = document.getElementById(element);
	        if(seconds == 0) {
	            if(minutes == 0) {
	                el.innerHTML = "countdown's over!";                    
	                clearInterval(interval);
	                return;
	            } else {
	                minutes--;
	                seconds = 60;
	            }
	        }
	        if(minutes > 0) {
	            var minute_text = minutes + (minutes > 1 ? ' minutes' : ' minute');
	        } else {
	            var minute_text = '';
	        }
	        var second_text = seconds > 1 ? 'seconds' : 'second';
	        el.innerHTML = minute_text + ' ' + seconds + ' ' + second_text + ' remaining';
	        seconds--;
	    }, 1000);
	}
</script>
